]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Constrain zoomed overview windows to the current monitor
authorAlexander Larsson <alexl@redhat.com>
Wed, 9 Mar 2011 14:59:58 +0000 (15:59 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 17 Mar 2011 13:13:55 +0000 (14:13 +0100)
Additionally, the constraint to not overlap the panel should only happen
on the primary monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=609258

js/ui/workspace.js

index 05a22f7e5c79e7ffa6dfadd8df8d2343f484ffbf..974893a27280426a6b035f0d07d6a4b6652fdabb 100644 (file)
@@ -221,8 +221,15 @@ WindowClone.prototype = {
 
         let [width, height] = this.actor.get_transformed_size();
 
-        this.actor.x = _clamp(this.actor.x, 0, global.screen_width  - width);
-        this.actor.y = _clamp(this.actor.y, Main.panel.actor.height, global.screen_height - height);
+        let monitorIndex = this.metaWindow.get_monitor();
+        let availArea = global.get_monitors()[monitorIndex];
+        if (monitorIndex == global.get_primary_monitor_index()) {
+            availArea.y += Main.panel.actor.height;
+            availArea.height -= Main.panel.actor.height;
+        }
+
+        this.actor.x = _clamp(this.actor.x, availArea.x, availArea.x + availArea.width - width);
+        this.actor.y = _clamp(this.actor.y, availArea.y, availArea.y + availArea.height - height);
     },
 
     _zoomStart : function () {